package com.server.llh.llhserverwork.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 * Created by ZTF on 2017/3/22.
 * 食品时间选择
 */

public class FoodDataSetting {
    public static   String[] dateStringArray = new String[3];

    @SuppressWarnings({ "static-access", "unused" })
    public static String[]  getDate() {
        Date date = new Date();// 取时间
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.add(calendar.DATE, 0);//
        date = calendar.getTime(); // 这个时间就是日期往后推一天的结果
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        String dateString = formatter.format(date);
        // dateStringArray[0] = "今日:" + dateString;
        dateStringArray[0] = "今日";

        date = new Date();// 取时间
        calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.add(calendar.DATE, 1);// 把日期往后增加一天.整数往后推,负数往前移动
        date = calendar.getTime(); // 这个时间就是日期往后推一天的结果
        formatter = new SimpleDateFormat("yyyy-MM-dd");
        dateString = formatter.format(date);
        dateStringArray[1] = "明日";

        date = new Date();// 取时间
        calendar = new GregorianCalendar();
        calendar.setTime(date);
        calendar.add(calendar.DATE, 2);// 把日期往后增加2天.整数往后推,负数往前移动
        date = calendar.getTime(); // 这个时间就是日期往后推一天的结果
        formatter = new SimpleDateFormat("yyyy-MM-dd");
        dateString = formatter.format(date);
        dateStringArray[2] = "后日";
        return dateStringArray;
    }
}
